import { myPost } from '@/util/request'
import { API_SERVER } from '../service'

/**
 * @desc 获取角色列表,角色下用户列表list
 */
export const roleList = (data) => {
  return myPost(`${API_SERVER}/v2/role/index`, data )
}

/**
 * @desc 获取角色创建下拉数据
 */
export const sysdicGetByCode = (data) => {
  return myPost(`${API_SERVER}/v2/sysdic/getByCode`, data)
}

/**
 * @desc 字典查询
 */
export const sysdicIndex = (data) => {
  return myPost(`${API_SERVER}/v2/sysdic/index`, data)
}


/**
 * @desc 根据id获取字典项
 */
export const sysdicGetSysdic = (data) => {
  return myPost(`${API_SERVER}/v2/sysdic/getSysdic`, data)
}

/**
 * @desc 角色新增
 */
export const roleAdd = (data) => {
  return myPost(`${API_SERVER}/v2/role/add`, data)
}

/**
 * @desc 角色编辑
 */
export const roleEdit = (data) => {
  return myPost(`${API_SERVER}/v2/role/edit`, data)
}

/**
 * @desc 角色删除
 */
export const roleDelete = (data) => {
  return myPost(`${API_SERVER}/v2/role/delete`, data)
}

/**
 * @desc 用户加入角色
 */
export const roleAddrole = (data) => {
  return myPost(`${API_SERVER}/v2/role/addrole`, data)
}

/**
 * @desc 用户移出角色
 */
export const roleRemoverole = (data) => {
  return myPost(`${API_SERVER}/v2/role/removerole`, data)
}

/**
 * @desc 获取角色的角色授权-树形结构
 */
export const roleAuth = (data) => {
  return myPost(`${API_SERVER}/v2/role/auth`, data)
}

/**
 * @desc 角色授权-提交保存
 */
export const roleSave = (data) => {
  return myPost(`${API_SERVER}/v2/role/auth/save`, data)
}